<?php
/**
 * 分销佣金日志管理
 *
 *
 *
 * * @网店运维 (c) 2015-2018 ShopWWI Inc. (http://www.shopwwi.com)
 * @license    http://www.shopwwi.c om
 * @link       交流群号：111731672
 * @since      网店运维提供技术支持 授权请购买shopnc授权
 */
defined('ByShopWWI') or exit('Access Invalid!');

class brokerageModel extends Model {
    
    
    public function __construct(){
        parent::__construct('brokerage_record');
    }
   
   
    
    
     /**
     * 添加佣金日志信息
     *
     * @param array $param 添加信息数组
     */
    public function addBrokerageRecord($param) {
        if(empty($param)) {
            return false;
        }
        return $this->insert($param);
    }
    /**
     * 佣金日志列表
     *
     * @param unknown $condition
     * @param string $pagesize
     * @param string $fields
     * @param string $order
     */
    public function getBrokerageRecordList($condition = array(), $pagesize = '', $fields = '*', $order = '', $limit = ''){
        return $this->where($condition)->field($fields)->order($order)->limit($limit)->page($pagesize)->select();
    }
    
     /**
     * 取日志总数
     * @param unknown $condition
     */
    public function getBrokerageRecordCount($condition = array()) {
        return $this->where($condition)->count();
    }
    
    
    /**
     * 佣金日志详细信息
     *
     * @param array $condition 条件数组
     * @param array $field   查询字段
     */
    public function getBrokerageRecordInfo($where = array(), $field = '*', $order = '',$group = ''){
        $info = $this->where($where)->field($field)->order($order)->group($group)->find();
        if (!$info){
            return array();
        }
        return $info;
    }
}
